#ifndef _WORK_CHANNEL_MANAGER_93F56696_66BC_4084_8031_08BA744EE78E_
#define _WORK_CHANNEL_MANAGER_93F56696_66BC_4084_8031_08BA744EE78E_
#include <map>
#include "base/threading/non_thread_safe.h"
#include "work_channel.h"

namespace dl {

class WorkChannelManager : public ConnectTransfer, public base::NonThreadSafe {
public:
  explicit WorkChannelManager(MessageLoop* message_loop, 
      MessageTransfer* message_transfer, base::Closure exit_callback);
  ~WorkChannelManager();
	void CreateChannel(const std::string& name);

  // ConnectTransfer 接口
  virtual void OnConnectArrived(WorkChannel* channel, int32 peer_pid);
  virtual void OnConnectError(WorkChannel* channel);

private:
  base::Closure exit_callback_;
  MessageLoop* message_loop_;
  MessageTransfer* message_transfer_;
  typedef std::map<int32, WorkChannel*> ChannelMap;
  ChannelMap render_hosts_;  // ProcessID => WorkChannel*
};

}

#endif//_WORK_CHANNEL_MANAGER_93F56696_66BC_4084_8031_08BA744EE78E_
